<template>
	<view>

		<shouye id="shouye" :style="'display:' + (PageCur == 'shouye' ? '' : 'none')" ref="Shouye">
			<text style="position: relative">文本内容...</text>
		</shouye>
		<wode id="wode" :style="'display:' + (PageCur == 'wode' ? '' : 'none')" ref="Wode"></wode>

		<view class="cu-bar tabbar bg-white shadow foot">
			<view class="action" @tap="NavChange" data-cur="shouye">
				<view class="cuIcon-cu-image">
					<image :src="'../../static/images/tabbar/all' + (PageCur == 'shouye' ? '_cur' : '') + '.png'"></image>
				</view>
				<view :class="PageCur == 'shouye' ? 'text-black' : 'text-gray'">首页</view>
			</view>
			<view class="action" @tap="NavChange" data-cur="wode">
				<view class="cuIcon-cu-image">
					<image :src="'../../static/images/tabbar/account' + (PageCur == 'wode' ? '_cur' : '') + '.png'"></image>
				</view>
				<view :class="PageCur == 'wode' ? 'text-black' : 'text-gray'">我的</view>
			</view>
		</view>
	</view>
</template>

<script>
	import shouye from '@/pages/shouye/index';
	import wode from '@/pages/wode/index';
	//index.js
	//获取应用实例
	const app = getApp();
	export default {
		components: {
			shouye,
			wode
		},
		data() {
			return {
				PageCur: 'shouye',
				PageCur_t: ''
			};
		},
		onShow() {
			if (this.PageCur == '') {
				this.setData({
					PageCur: this.PageCur_t
				});
			}

			setTimeout(() => {
				this.getShow()
			})
		},
		onHide() {
			this.setData({
				PageCur_t: this.PageCur,
				PageCur: ''
			});
		},
		methods: {
			NavChange(e) {
				this.setData({
					PageCur: e.currentTarget.dataset.cur
				});
			},
			getShow() {
				this.$refs.Shouye.getNewWeek()
				this.$refs.Wode.getNewInfo()
			}
		}
	};
</script>
<style>
	@import './index.css';
</style>
